const fs = require('fs');
const { Transform } = require('stream');
exports.default = () => {
  const readStream = fs.createReadStream('normalize.css');
  const writeStream = fs.createWriteStream('normalize.min.css');
  const transform = new Transform({
    transform(chunk, encoding, callback) {
      const source = chunk.toString();
      const result = source.replace(/\s+/g, '').replace(/\s+/g, '');
      callback(null, result);
    }
  });
  readStream.pipe(transform).pipe(writeStream); // 将normalize的内容写入normalize.min中
  return readStream;
}
